@import './variables.scss';

$menu-prefix-cls: '#{$x6-prefix}-menu';

$menu-bg: #fff;
$menu-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
$menu-item-divider-bg: rgba(150, 150, 150, 0.2);
$menu-item-text-color: #595959;
$menu-item-hover-bg: #f5f5f5;
$menu-item-hover-color: #262626;
$menu-submenu-arrow-color: #262626;

.#{$menu-prefix-cls} {
    $self: &;
    position: relative;
    display: inline-block;
    min-width: 160px;
    min-height: 32px;
    margin: 0;
    padding: 4px 0;
    background-color: $menu-bg;
    outline: 0;
    // box-shadow: $menu-shadow;

    &-item {
        position: relative;
    }

    &-item-active > &-item-button,
    &-item:hover > &-item-button {
        color: $menu-item-hover-color;
        background: $menu-item-hover-bg;
    }

    &-item-divider {
        display: block;
        width: 100%;
        height: 1px;
        margin: 4px 0;
        background: $menu-item-divider-bg;
        pointer-events: none;
    }

    &-item-button {
        position: relative;
        display: flex;
        align-content: center;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        height: 28px;
        padding: 0 12px;
        color: $menu-item-text-color;
        text-align: left;
        background: transparent;
        border: none;
        outline: none;
        box-shadow: none;
        cursor: pointer;
    }

    &-item-hidden {
        display: none;
    }

    &-item-disabled > &-item-button,
    &-item-disabled:hover > &-item-button {
        color: $menu-item-text-color;
        background-color: transparent;
        cursor: not-allowed;
        opacity: 0.4;
    }

    &-item-icon {
        position: absolute;
        bottom: -3px;
        left: 0px;
        width: 24px;
        height: 24px;
        font-size: 13px;
    }

    &-item-text {
        padding-right: 56px;
        overflow: hidden;
        font-size: 13px;
        white-space: nowrap;
        text-overflow: ellipsis;
        margin-left: 4px;
    }

    &-item-hotkey {
        font-size: 13px;
        opacity: 0.75;
    }

    &-submenu-arrow,
    &-submenu#{$menu-prefix-cls}-item-disabled:hover
        & > .#{$menu-prefix-cls}-item-button
        & > .#{$menu-prefix-cls}-submenu-arrow {
        position: absolute;
        top: 10px;
        right: 12px;
        width: 0;
        height: 0;
        border-top: 4px solid rgba(0, 0, 0, 0);
        border-bottom: 4px solid rgba(0, 0, 0, 0);
        border-left: 5px solid $menu-submenu-arrow-color;
        opacity: 0.4;
        pointer-events: none;
    }

    &-submenu-menu,
    &-submenu#{$menu-prefix-cls}-item-disabled:hover > &-submenu-menu {
        position: absolute;
        top: -5px;
        left: 100%;
        z-index: 9999;
        min-width: 200px;
        margin-left: -4px;
        padding: 5px 0;
        background: $menu-bg;
        box-shadow: $menu-shadow;
        transform: translateX(-10px);
        visibility: hidden;
        opacity: 0;
        transition: all 0.25s cubic-bezier(0.3, 1.2, 0.2, 1);
    }

    &-submenu#{$menu-prefix-cls}-item-active,
    &-submenu:hover {
        & > #{$menu-prefix-cls}-item-button > .#{$menu-prefix-cls}-submenu-arrow {
            opacity: 0.75;
        }
    }

    &-submenu#{$menu-prefix-cls}-item-active > &-submenu-menu,
    &-submenu:hover > &-submenu-menu {
        transform: translateX(0);
        visibility: visible;
        opacity: 1;
    }

    &.#{$menu-prefix-cls}-has-icon &-item-button {
        padding-left: 30px;

        .#{$menu-prefix-cls}-item-icon {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .#{$menu-prefix-cls}-item-text {
            padding-left: 2px;
        }
    }

    &.#{$menu-prefix-cls}-border {
        box-shadow: 0 2px 10px rgb(0 0 0 / 12%);
    }
}
